package com.bawei.mall.product.controller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.product.domain.MallProductOrderInfo;
import com.bawei.mall.product.domain.model.MallProductOrder;
import com.bawei.mall.product.service.IMallProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author：作者姓名
 * @Package：com.bawei.mall.product.controller
 * @Project：mall_cloud
 * @name：MallProductOrder
 * @Date：2024/7/9 11:52
 */
@RestController
@RequestMapping("/order")
public class MallProductOrderController {

    @Autowired
    private IMallProductOrderService mallProductOrderService;

    @PostMapping("/generateConfirmOrder")
    public R<MallProductOrder> generateConfirmOrder(@RequestBody List<Integer> cartIds) {
        return mallProductOrderService.selectGenerateConfirmOrder(cartIds);
    }

    @PostMapping("/generateOrder")
    public R insertOrder(@RequestBody MallProductOrderInfo mallProductOrderInfo) {
        mallProductOrderService.insertMallProductOrderInfo(mallProductOrderInfo);
        return R.ok();
    }






}
